package com.blog.web.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.blog.web.bean.Article;
import com.blog.web.dao.ArticleMapper;
import com.blog.web.service.ArticleService;


/**
 * @todo ArticleServiceImpl
 * @author fg
 * @date 2016年3月24日
 */
@Service
public class ArticleServiceImpl implements ArticleService
{
	@Resource
	ArticleMapper articleMapper;

	public List<Article> queryArticleByOption(Map<String, String> map) 
	{
		return articleMapper.selectArticleByOption(map);
	}

	public Integer addOrSaveArticle(Article article) {
		if(article.getId()==null)
		{
			article.setIsDeleted(0);
			return articleMapper.insertArticle(article);
		}
		else
		{
			return articleMapper.updateArticleById(article);
		}
	}

	public Article queryArticleById(Integer id) {
		return articleMapper.selectArticleById(id);
	}

	public Integer modifyArticle(Article article) {
		return articleMapper.updateArticleById(article);
	}

	
}
